<div class="form-group">
    <label class="control-label" for="textinput">小区:</label>
    <select ng-model="communityId" ng-options="m.objId as m.communityName for m in communityLabelList.data"
            ng-change="getList(communityId,level)">
        <option value="">-- 请选择 --</option>
    </select>
    <label class="control-label" for="textinput">精华帖:</label>
    <select ng-model="level"
            ng-change="getList(communityId,level)">
        <option value="3">全部</option>
        <option value="1">精华帖</option>
        <option value="0">非精华帖</option>
    </select>
</div>
<div class="tabbable" id="tabs-932122" style="margin-top: 40px" ng-show="communityId!=null">
    <ul class="nav nav-tabs">
        <li class="active"><a data-toggle="tab" href="#tab_all" ng-click="getAllUgc(communityId,false)">全部</a></li>
        <li><a data-toggle="tab" href="#tab_activity" ng-click="getActivityList(communityId,false)">邻里活动</a></li>
    </ul>

    <div class="tab-content">

        <div class="tab-pane active" id="tab_all">
            <mutau>
                <ul class="pagination" num-pages="tasks.pageCount" current-page="tasks.currentPage"
                    on-select-page="selectPage(page)">
                    <li ng-class="{disabled: noPrevious()}"><a ng-click="selectPrevious()">&laquo;</a>

                    </li>
                    <li ng-repeat="page in pages" ng-class="{active: isActive(page)}"><a
                            ng-click="selectPage(page)">{{page}}</a>

                    </li>
                    <li ng-class="{disabled: noNext()}"><a ng-click="selectNext()">&raquo;</a>

                    </li>
                    <li ng-show="currentPage>6"><a ng-click="selectPage(1)">首页</a>

                    </li>
                </ul>
            </mutau>

            <table class="table table-condensed">
                <thead>
                <tr>
                    <th>小区</th>
                    <th>昵称</th>
                    <th>标题</th>
                    <th>描述</th>
                    <th>创建时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr ng-repeat="activity in allList">

                    <td>{{activity.community.communityName}}</td>
                    <td>{{activity.createdBy.nickName}}</td>
                    <td>{{activity.title}}</td>
                    <td>{{activity.desc}}</td>
                    <td>{{activity.dateCreated | date:'yyyy-MM-dd HH:mm:ss'}}</td>
                    <td>
                        <a class="btn btn-primary btn-xs" ng-show="activity.displayOrder==null"
                           ng-click="moveAllToTop(activity.objId,communityId)">置顶</a>
                        <a class="btn btn-danger btn-xs" ng-show="activity.displayOrder!=null"
                           ng-click="cancelAllTop(activity.objId,communityId)">取消</a>
                    </td>
                </tr>
                </tbody>
            </table>

        </div>

        <div class="tab-pane" id="tab_activity">

            <mutau>
                <ul class="pagination" num-pages="tasks.pageCount" current-page="tasks.currentPage"
                    on-select-page="selectPage(page)">
                    <li ng-class="{disabled: noPrevious()}"><a ng-click="selectPrevious()">&laquo;</a>

                    </li>
                    <li ng-repeat="page in pages" ng-class="{active: isActive(page)}"><a
                            ng-click="selectPage(page)">{{page}}</a>

                    </li>
                    <li ng-class="{disabled: noNext()}"><a ng-click="selectNext()">&raquo;</a>

                    </li>
                    <li ng-show="currentPage>6"><a ng-click="selectPage(1)">首页</a>

                    </li>
                </ul>
            </mutau>

            <table class="table table-condensed">
                <thead>
                <tr>
                    <th>小区</th>
                    <th>标签</th>
                    <th>昵称</th>
                    <th>标题</th>
                    <th>描述</th>
                    <th>创建时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr ng-repeat="activity in activityList">

                    <td>{{activity.community.communityName}}</td>
                    <td><span ng-repeat="t in activity.tag">{{t.value}} </span></td>
                    <td>{{activity.createdBy.nickName}}</td>
                    <td>{{activity.title}}</td>
                    <td>{{activity.desc}}</td>
                    <td>{{activity.dateCreated | date:'yyyy-MM-dd HH:mm:ss'}}</td>
                    <td><a class="btn btn-default btn-xs" data-toggle="modal" data-target="#edit{{$index}}"
                           ng-click="initTag()">编辑</a>
                        <a class="btn btn-primary btn-xs" ng-show="activity.displayOrder!=3"
                           ng-click="moveToTop(activity.objId,communityId)">置顶</a>
                        <a class="btn btn-danger btn-xs" ng-show="activity.displayOrder==3"
                           ng-click="cancelTop(activity.objId,communityId)">取消</a>

                        <a ng-show="activity.level!=1" class="btn btn-secondary btn-xs"
                           ng-click="changeLevel(activity.objId,1)">设置精华贴</a>
                        <a ng-show="activity.level==1" class="btn btn-danger btn-xs"
                           ng-click="changeLevel(activity.objId,0)">取消精华帖</a>

                        <a class="btn btn-primary btn-xs" ng-show="activity.isFresh !=true" data-toggle="modal"
                           data-target="#fresh{{$index}}"
                           ng-click="">添加新鲜事</a>


                        <div class="modal fade" id="fresh{{$index}}" tabindex="-1" role="dialog"
                             aria-labelledby="myModalLabel" aria-hidden="false">
                            <div class="modal-dialog">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <button type="button" class="close" data-dismiss="modal"
                                                aria-label="Close"><span
                                                aria-hidden="true">&times;</span></button>
                                        <h5 class="modal-title" id="myFresh">活动：{{activity.desc}}</h5>
                                    </div>
                                    <div class="modal-body">
                                        <h6 class="modal-title" id="myFresh1">请输入标题：</h6>
                                        <textarea rows="5" ng-model="title" required style="width:100%"
                                                  tabindex="7"></textarea>
                                    </div>
                                    <div class="modal-footer">
                                        <button ng-click="addActivityToFreshNews(activity,title)" type="button"
                                                class="btn btn-default btn-sm" data-dismiss="modal">确定
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <a ng-show="activity.isFresh == true">已在新鲜事</a>


                        <div class="modal fade" id="edit{{$index}}" tabindex="-1" role="dialog"
                             aria-labelledby="myModalLabel" aria-hidden="false">
                            <div class="modal-dialog">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <button type="button" class="close" data-dismiss="modal"
                                                aria-label="Close"><span
                                                aria-hidden="true">&times;</span></button>
                                        <h5 class="modal-title" id="refusal">标题：{{activity.title}}</h5>
                                    </div>
                                    <div class="modal-body">
                                        <div>
                                            <label ng-repeat="m in tag.data">
                                                <input style="zoom:1.8;margin-left: 10px;vertical-align:middle"
                                                       type="checkbox" ng-model="chk" ng-click="toggle(chk,m.objId)"/>{{m.value}}
                                            </label>
                                        </div>
                                    </div>
                                    <div class="modal-footer">
                                        <button
                                                class="btn btn-default btn-sm" data-dismiss="modal">取消
                                        </button>
                                        <button ng-click="updateActivity(activity.objId)"
                                                type="submit"
                                                class="btn btn-default btn-sm" data-dismiss="modal">确定
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>


<script>
    $(function () {
        $('#tabs-932122 a').click(function (e) {
            e.preventDefault();//阻止a链接的跳转行为
            $(this).tab('show');//显示当前选中的链接及关联的content
        })
    })
</script>